/*
 * Selling Partner API for Orders
 *
 * Use the Orders Selling Partner API to programmatically retrieve order information. With this API, you can develop fast, flexible, and custom applications to manage order synchronization, perform order research, and create demand-based decision support tools.   _Note:_ For the JP, AU, and SG marketplaces, the Orders API supports orders from 2016 onward. For all other marketplaces, the Orders API supports orders for the last two years (orders older than this don't show up in the response).
 *
 * The version of the OpenAPI document: v0
 * Generated by: https://github.com/openapitools/openapi-generator.git
 */


using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = software.amzn.spapi.Client.OpenAPIDateConverter;

namespace software.amzn.spapi.Model.orders.v0
{
    /// <summary>
    /// A list of orders along with additional information to make subsequent API calls.
    /// </summary>
    [DataContract(Name = "OrdersList")]
    public partial class OrdersList : IValidatableObject
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="OrdersList" /> class.
        /// </summary>
        [JsonConstructorAttribute]
        protected OrdersList() { }
        /// <summary>
        /// Initializes a new instance of the <see cref="OrdersList" /> class.
        /// </summary>
        /// <param name="orders">A list of orders. (required).</param>
        /// <param name="nextToken">When present and not empty, pass this string token in the next request to return the next response page..</param>
        /// <param name="lastUpdatedBefore">Use this date to select orders that were last updated before (or at) a specified time. An update is defined as any change in order status, including the creation of a new order. Includes updates made by Amazon and by the seller. Use [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) format for all dates..</param>
        /// <param name="createdBefore">Use this date to select orders created before (or at) a specified time. Only orders placed before the specified time are returned. The date must be in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) format..</param>
        public OrdersList(List<Order> orders = default(List<Order>), string nextToken = default(string), string lastUpdatedBefore = default(string), string createdBefore = default(string))
        {
            // to ensure "orders" is required (not null)
            if (orders == null)
            {
                throw new ArgumentNullException("orders is a required property for OrdersList and cannot be null");
            }
            this.Orders = orders;
            this.NextToken = nextToken;
            this.LastUpdatedBefore = lastUpdatedBefore;
            this.CreatedBefore = createdBefore;
        }

        /// <summary>
        /// A list of orders.
        /// </summary>
        /// <value>A list of orders.</value>
        [DataMember(Name = "Orders", IsRequired = true, EmitDefaultValue = true)]
        public List<Order> Orders { get; set; }

        /// <summary>
        /// When present and not empty, pass this string token in the next request to return the next response page.
        /// </summary>
        /// <value>When present and not empty, pass this string token in the next request to return the next response page.</value>
        [DataMember(Name = "NextToken", EmitDefaultValue = false)]
        public string NextToken { get; set; }

        /// <summary>
        /// Use this date to select orders that were last updated before (or at) a specified time. An update is defined as any change in order status, including the creation of a new order. Includes updates made by Amazon and by the seller. Use [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) format for all dates.
        /// </summary>
        /// <value>Use this date to select orders that were last updated before (or at) a specified time. An update is defined as any change in order status, including the creation of a new order. Includes updates made by Amazon and by the seller. Use [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) format for all dates.</value>
        [DataMember(Name = "LastUpdatedBefore", EmitDefaultValue = false)]
        public string LastUpdatedBefore { get; set; }

        /// <summary>
        /// Use this date to select orders created before (or at) a specified time. Only orders placed before the specified time are returned. The date must be in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) format.
        /// </summary>
        /// <value>Use this date to select orders created before (or at) a specified time. Only orders placed before the specified time are returned. The date must be in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) format.</value>
        [DataMember(Name = "CreatedBefore", EmitDefaultValue = false)]
        public string CreatedBefore { get; set; }

        /// <summary>
        /// Returns the string presentation of the object
        /// </summary>
        /// <returns>String presentation of the object</returns>
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("class OrdersList {\n");
            sb.Append("  Orders: ").Append(Orders).Append("\n");
            sb.Append("  NextToken: ").Append(NextToken).Append("\n");
            sb.Append("  LastUpdatedBefore: ").Append(LastUpdatedBefore).Append("\n");
            sb.Append("  CreatedBefore: ").Append(CreatedBefore).Append("\n");
            sb.Append("}\n");
            return sb.ToString();
        }

        /// <summary>
        /// Returns the JSON string presentation of the object
        /// </summary>
        /// <returns>JSON string presentation of the object</returns>
        public virtual string ToJson()
        {
            return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
        }

        /// <summary>
        /// To validate all properties of the instance
        /// </summary>
        /// <param name="validationContext">Validation context</param>
        /// <returns>Validation Result</returns>
        IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
        {
            yield break;
        }
    }

}
